{% extends "layout.html" %}
{% block body %}

<!-- BEGIN /now block -->
  <script src="/static/js/skyline.js"></script>
	<ol class="breadcrumb">
		<li><a href="/">Home</a></li>
		<li><a href="/api">api</a></li>
		<li class="active"><span class="logo"><span class="sky">api</span> <span class="re">documentation</span></li>
	</ol>


	  <h3><span class="logo"><span class="sky">API methods ::</span> <span class="re">documentation</span></span></h3>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?airgapped_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all metrics which have been identified as having airgaps within the <code>settings.MAX_AIRGAP_PERIOD</code> as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?airgapped_metrics">/api?airgapped_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?airgapped_metrics</code></td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "['remote_hosts.graphite-labs_wikimedia_org.cloudinfra.cloudinfra-db01.cpu.total.idle', 60, 1580907541, 1580907899, 0]",
      "['remote_hosts.graphite-labs_wikimedia_org.cloudinfra.cloudinfra-db01.cpu.total.iowait', 60, 1580907541, 1580907899, 0]"
    ]
  },
  "status": {}
}</code><br>
Or if no airgapped metrics are present <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?airgap_filled</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Removes a metric airgap from the analyzer.airgapped_metrics Redis set.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/api?airgap_filled</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>metric=[metric_name | str | <font color=red>required</font>]</br>
                  resolution=[resolution/frequency in seconds | int | <font color=red>required</font>]</br>
                  start=[unix timestamp | int | <font color=red>required</font>]</br>
                  end=[unix timestamp | int | <font color=red>required</font>]</br>
                  attempts=[number of attempts in fill the metric | int | <font color=red>required</font>]</br>
                  <code>NOTE: the number of attempts must match the number of attempts that were returned in the airgapped_metrics</code><br>
                  <code>for the airgap, it must not be incremented as it is used to match the airgap item in the Redis set for removal.</code><br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?airgap_filled&metric=test.metric&resolution=60&start=1580926312&end=1580926712&attempts=0</code></td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - airgapped metric item removed with json response, example
                  <code>{
  "data": {
    "removed_airgap": [
      "test.metric",
      60,
      1580926312,
      1580926712,
      0
    ]
  },
  "status": {}
}</code><br>
                  400 - bad parameter<br>
                  404 - airgap metric entry not found<br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?alerting_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all metrics which have SMTP alerting enabled on them as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?alerting_metrics">/api?alerting_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?alerting_metrics</code><br>
              <code>/api?alerting_metrics&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "test.metric",
      "vista.nodes.skyline-1.cpu.user"
    ]
  },
  "status": {}
}</code><br>
Or if no metrics of no metrics are set to alert <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?analyzer_last_status</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns the last timestamp that Analyzer ran as a json object.  The Redis analyzer key is set every run with a TTL of 120 seconds</br>
                  If the Redis key does not exist the request is responded to with HTTP status code <code>410 GONE</code>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?analyzer_last_status">/api?analyzer_last_status</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?analyzer_last_status</code></td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{"data":{"timestamp":1604421547},"status":{}}
</code><br>
Or if Analyzer has not run in 120 seconds <code>{"data":{"timestamp":null},"status":{}}</code> with status code 410<br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?anomaly</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns the information about an anomaly as a json object, with cross_correlations, possible_related_matches and possible_related_anomalies<br>
                  If the anomaly is in progress the end_timestamp value returned will be null e.g. <code>"end_timestamp": null,</code>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/api?anomaly</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>anomaly=[true | boolean | <font color=red>required</font>]</br>
                  id=[anomaly id | int | <font color=red>required</font>]</br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request examples:</td>
		          <td><code>/api?anomaly=true&id=12345</code><br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 with json response<br>
<code>{
  "data": {
    "anomaly": {
      "cross correlations": {
        "server-12345.cpu-total.cpu.usage_iowait": {
          "coefficient": 0.94491,
          "shifted": 0,
          "shifted_coefficient": 0.94491
        },
        "server-12345.cpu-total.cpu.usage_irq": {
          "coefficient": 0.99733,
          "shifted": 0,
          "shifted_coefficient": 0.99733
        },
        ...
      },
      "end_timestamp": 1599558120,
      "id": "12345",
      "metric": "server-12345.cpu-total.cpu.usage_user",
      "possible related anomaly ids": {
        "12344": {
          "metric": "server-12345.cpu-total.cpu.usage_irq",
          "timestamp": 1599558060
        },
        ...
        ...
      },
      "possible related match ids": {
        "169524": {
          "fp id": 8815,
          "layer id": "None",
          "matched by": "features profile - minmax - echo",
          "metric": "server-12345.cpu-total.cpu.usage_system",
          "timestamp": 1599558060
        },
        ...
        ...
      },
      "timestamp": 1599558120,
      "value": 62
    }
  },
  "status": {}
}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?batch_processing_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all batch processing metrics as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?batch_processing_metrics">/api?batch_processing_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?batch_processing_metrics</code><br>
              <code>/api?batch_processing_metrics&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "vista.demo_robustperception_io.prometheus.node_memory_MemAvailable_bytes",
      "vista.demo_robustperception_io.prometheus.node_disk_io_time_weighted_seconds_total"
    ]
  },
  "status": {}
}</code><br>
Or if no batch processing metrics are present <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?derivative_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all metrics (with their FULL_NAMESPACE metric name) have identified as derivative metrics as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?derivative_metrics">/api?derivative_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?derivative_metrics</code><br>
              <code>/api?derivative_metrics&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "metrics.test.metric",
      "metrics.vista.nodes.skyline-1.cpu.user"
    ]
  },
  "status": {}
}</code><br>
Or if no metrics if no metrics are derivative metrics <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>


	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/flux/metric_data</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Allows to submit a metric, timestamp and value to Flux to send to Graphite.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/flux/metric_data</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>metric=[metric_name | str | <font color=red>required</font>]</br>
                  timestamp=[unix timestamp | int | <font color=red>required</font>]</br>
                  value=[value | float | <font color=red>required</font>]</br>
                  key=[API key | str | <font color=red>required</font>]</br>
                  fill=[whether this is backfill | boolean | optional]</br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/flux/metric_data?metric=vista.nodes.skyline-1.cpu.user&amp;timestamp=1478021700&value=1.0&key=YOURown32charSkylineAPIkeySecret</code><br>
                  <code>/flux/metric_data?metric=vista.nodes.skyline-1.cpu.user&amp;timestamp=1478021700&value=1.0&key=YOURown32charSkylineAPIkeySecret&fill=true</code>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>204<br>
                  200 - if in debug mode and returns a json response with the query_string, request parameters and values and the metric data submitted<br>
                  400 - bad parameter<br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/flux/metric_data_post</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Allows to submit a metric, timestamp and value to Flux to send to Graphite.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/flux/metric_data_post</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>POST</td>
  		      </tr>
  		      <tr>
  		        <td>Request data example:</td>
		          <td>
{
    "metric": "metric|str",
    "timestamp": "timestamp|int",
    "value": "value|float",
    "key": "api_key|str",
    "fill": "boolean|optional"
}
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>204<br>
                  200 - if in debug mode and returns a json response with the posted data<br>
                  400 - missing parameter in post data<br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?get_json</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns the time series for a metric from the training data or features profile as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/api?get_json</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>get_json=[true | boolean | <font color=red>required</font>]</br>
                  metric=[metric_name | str | <font color=red>required</font>]</br>
                  timestamp=[unix timestamp | int | <font color=red>required</font>]</br>
                  source=[features_profile|training_data | str | <font color=red>required</font>]</br>
                  full_duration_data=[whether to return FULL_DURATION time series | boolean | optional]</br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request examples:</td>
		          <td><code>/api?get_json=true&source=features_profile&amp;timestamp=1553711508&metric=test.metric&full_duration_data=true</code><br>
                  <code>/api?get_json=true&source=features_profile&amp;timestamp=1553711508&metric=test.metric&full_duration_data=true</code><br>
                  <code>/api?get_json=true&source=training_data&amp;timestamp=1553711909&metric=test.metric</code><br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 with json response<br>
<code>{
  "datapoints": [
    [
      1486749694,
      1
    ],
    [
      1486749704,
      0
    ],
..., ...,
    [
      1486836735,
      0
    ]
  ],
  "metric": "stats.statsd.graphiteStats.calculationtime"
}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?graphite_metric</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns the time series for a metric from Graphite as a PJSON object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/api?graphite_metric</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>metric=[metric_name | str | <font color=red>required</font>]</br>
                  from_timestamp=[unix timestamp | int | <font color=red>required</font>]</br>
                  until_timestamp=[unix timestamp | int | <font color=red>required</font>]</br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request examples:</td>
		          <td><code>/api?graphite_metric=stats.statsd.graphiteStats.calculationtime&from_timestamp=1580998701&until_timestamp=1580999701</code><br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 with json response<br>
<code>{"results": [[1580998730.0, 0.0], [1580998790.0, 0.0], ..., [1580999690.0, 0.0]]}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?ionosphere_learn_work</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all the pending Ionosphere learn work in the ionosphere.learn.work Redis set as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?ionosphere_learn_work">/api?ionosphere_learn_work</a></br>
              <a target='_blank' href="/api?ionosphere_learn_work&format=json">/api?ionosphere_learn_work&format=json</a>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>format=json [optional]</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?ionosphere_learn_work</code><br>
              <code>/api?ionosphere_learn_work&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response with strings of lists for literal_eval, example
                  <code>
{
  "data": {
    "metrics": [
      "['Soft', 'learn_fp_generation', 1580995360, 'test.metric', None, None]",
      "['Soft', 'learn_fp_human', 1580995460, 'test.metric.other', 123, 3]"
    ]
  },
  "status": {}
}</code><br>
Or if no metrics if all metrics are set to alert <code>{"data":{"metrics":[]},"status":{}}</code>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?ionosphere_learn_work&format=json</code></td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
              <td>200 - pure json response, example
              <code>
{
  "data": {
    "metrics": {
      "test.metric": {
        "deadline_type": "Soft",
        "generation": 0,
        "job_type": "learn_fp_generation",
        "parent_id": 0,
        "timestamp": 1580995360
      },
      "test.metric.other": {
        "deadline_type": "Soft",
        "generation": 3,
        "job_type": "learn_fp_human",
        "parent_id": 123,
        "timestamp": 1580995460
      }
    }
  },
  "status": {}
}</code><br>
Or if no metrics if all metrics are set to alert <code>{"data":{"metrics":{}},"status":{}}</code>
<br>
The items are as defined in <a target='_blank' href="https://earthgecko-skyline.readthedocs.io/en/latest/skyline.ionosphere.html#ionosphere.learn.ionosphere_learn">https://earthgecko-skyline.readthedocs.io/en/latest/skyline.ionosphere.html#ionosphere.learn.ionosphere_learn</a>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?ionosphere_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all Ionosphere enabled metrics (with their FULL_NAMESPACE metric name) as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?ionosphere_metrics">/api?ionosphere_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?ionosphere_metrics</code><br>
              <code>/api?ionosphere_metrics&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "metrics.test.metric",
      "metrics.vista.nodes.skyline-1.cpu.user"
    ]
  },
  "status": {}
}</code><br>
Or if no metrics if no metrics are Ionosphere enabled metrics <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?metric</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns the time series for a metric from Redis as a PJSON object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/api?metric</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>metric=[FULL_NAMESPACE + metric_name | str | <font color=red>required</font>]</br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request examples:</td>
		          <td><code>/api?metric=metrics.stats.statsd.graphiteStats.calculationtime</code><br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 with PJSON response<br>
<code>{"results": [[1580912307.0, 1.0], [1580912367.0, 1.0], ..., ..., , [1580999271.0, 0.0]]}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?last_analyzed_timestamp</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns the last timestamp that Analyzer analysed for a metric.</br>
                  If a timestamp for the metric does not exist the request is responded to with HTTP status code <code>400</code>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?last_analyzed_timestamp">/api?last_analyzed_timestamp</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>metric=[metric_name | str | <font color=red>required</font>]</br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?last_analyzed_timestamp&metric=stats.statsd.graphiteStats.calculationtime</code></br>
		          <td><code>/api?last_analyzed_timestamp&metric=stats.statsd.graphiteStats.calculationtime&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Response:</td>
  		        <td>200 - json response, example
                  <code>
{"data":{"last_analyzed_timestamp":1613564520,"metric":"stats.statsd.graphiteStats.calculationtime"},"status":{"cluster_data":true,"remote_data":false,"request_time":0.001747,"response":200}}
</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?mirage_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all Mirage enabled metrics (with their FULL_NAMESPACE metric name) as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?mirage_metrics">/api?mirage_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?mirage_metrics</code><br>
              <code>/api?mirage_metrics&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "metrics.test.metric",
      "metrics.vista.nodes.skyline-1.cpu.user"
    ]
  },
  "status": {}
}</code><br>
Or if no metrics if no metrics are Mirage enabled metrics <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?non_alerting_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all metrics that do not have a STMP alert defined for them as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?non_alerting_metrics">/api?non_alerting_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?non_alerting_metrics</code><br>
              <code>/api?non_alerting_metrics&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "test.metric",
      "vista.nodes.skyline-1.cpu.user"
    ]
  },
  "status": {}
}</code><br>
Or if no metrics if all metrics are set to alert <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>


	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?training_data</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all metrics and their anomaly timestamps which have training data.<br>
                  The <code>metric</code> and <code>timestamp</code> request arguments can be added to
                  filter by metric, namespace, timestamp or by metric and timestamp.
                  You can also use part of namespace as the <code>metric</code> and all metrics that match the namespace will be returned
              </td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?training_data">/api?training_data</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request examples:</td>
		          <td><code>/api?training_data</code><br>
                  <code>/api?training_data&metric=[metric_name]</code><br>
                  <code>/api?training_data&amp;timestamp=[timestamp]</code><br>
                  <code>/api?training_data&metric=[metric_name]&amp;timestamp=[timestamp]</code><br>
                  <code>/api?training_data&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
    "data": {
        "metrics": [
            [
                "remote_hosts.graphite-labs_wikimedia_org.cloudinfra.cloudinfra-db01.cpu.total.idle",
                1586521095
            ],
            [
                "remote_hosts.graphite-labs_wikimedia_org.cloudinfra.cloudinfra-db01.cpu.total.iowait",
                1586521155
            ]
        ]
    },
    "status": {}
}</code><br>
Or if no metrics with training data are present <code>{"data":{"metrics":[]},"status":{}}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>


	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?unique_metrics</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns a list of all metrics (with their FULL_NAMESPACE metric name) as a json object.</td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td><a target='_blank' href="/api?unique_metrics">/api?unique_metrics</a></td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Request example:</td>
		          <td><code>/api?unique_metrics</code><br>
              <code>/api?unique_metrics&cluster_data=true</code> [optional for clustered Skyline]
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 - json response, example
                  <code>
{
  "data": {
    "metrics": [
      "metrics.test.metric",
      "metrics.vista.nodes.skyline-1.cpu.user"
    ]
  },
  "status": {}
}</code><br>
              </td>
  		      </tr>
		    </tbody>
		  </table>

	  <h4><span class="logo"><span class="sky">API method ::</span> <span class="re">/api?yhat_values</span></span></h4>
  		  <table class="table table-hover">
  		    <thead>
  		      <tr>
  		        <th>Name</th>
  		        <th>Description</th>
  		      </tr>
  		    </thead>
  		    <tbody>
  		      <tr>
  		        <td>Description:</td>
  		        <td>Returns the yhat values (mean and value OPTIONAL) for a metric timeseries as a json object<br>
              yhat values default to the upper and lower three-sigma boundaries.<br>
              If any custom algorithms are in use the three-sigma yhat upper and lower vlues are replaced with the value (+/- 10%) which the custom algorithm did not trigger on<br>
              Where the customa algorithm replaces the three-sigma value in the yhat_upper or yhat_lower elements, a 3sigma_lower or 3sigma_upper will also be returned in the element
              </td>
  		      </tr>
  		      <tr>
  		        <td>Endpoint:</td>
  		        <td>/api?yhat_values</td>
  		      </tr>
  		      <tr>
  		        <td>Method:</td>
  		        <td>GET</td>
  		      </tr>
  		      <tr>
  		        <td>Parameters:</td>
  		        <td>yhat_values=[true | boolean | <font color=red>required</font>]</br>
                  metric=[metric name | str | <font color=red>required</font>]</br>
                  from=[unix timestamp | str | <font color=red>required</font>]</br>
                  until=[unix timestamp | str | <font color=red>required</font>]</br>
                  include_value=[false | boolean | optional defaults to false]</br>
                  include_mean=[false | boolean | optional defaults to false]</br>
                  include_yhat_real_lower=[false | boolean | optional defaults to false]</br>
                  include_anomalous_periods=[false | boolean | optional defaults to false]</br>
                  remove_prefix=[str | optional] - prefix string to remove (do not pass a trailing dot)</br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Request examples:</td>
		          <td><code>/api?yhat_values=true&metric=vista.demo_robustperception_io.prometheus.node_load1&from=1606147200&until=1606750440</code> only returns timestamps, yhat_upper and yhat_lower vlaues per timestamp<br>
		          <code>/api?yhat_values=true&metric=vista.demo_robustperception_io.prometheus.node_load1&from=1606147200&until=1606750440&include_yhat_real_lower=true&include_mean=true&include_value=true</code> only returns timestamps, yhat_upper, yhat_lower and yhat_real_lower (will not drop below 0 if the metric does not)<br>
              </td>
  		      </tr>
  		      <tr>
  		        <td>Responses:</td>
  		        <td>200 with json response<br>
<code>{
  "data": {
    "metric": "vista.demo_robustperception_io.prometheus.node_load1",
    "yhat_values": {
      "1606147260": {
        "yhat_lower": 1.2,
        "yhat_upper": 1.2
      },
      "1606147320": {
        "yhat_lower": 1.2,
        "yhat_upper": 1.2
      },...
      "1606750440": {
        "yhat_lower": 0.8529541536511133,
        "yhat_upper": 1.491394364351672
      }
    }
  },
  "status": {
    "request_time": "0.587132",
    "response": 200
  }
}</code><br>
With value, mean and yhat_real_lower passed
<code>{
  "data": {
    "metric": "vista.demo_robustperception_io.prometheus.node_load1",
    "yhat_values": {
      "1606147260": {
        "mean": 1.2,
        "value": 1.2,
        "yhat_lower": 1.2,
        "yhat_real_lower": 1.2,
        "yhat_upper": 1.2
      },
      "1606147320": {
        "mean": 1.2,
        "value": 1.2,
        "yhat_lower": 1.2,
        "yhat_real_lower": 1.2,
        "yhat_upper": 1.2
      },...
      "1606750440": {
        "mean": 1.1721742590013926,
        "value": 1.27,
        "yhat_lower": 0.8529541536511133,
        "yhat_real_lower": 0.8529541536511133,
        "yhat_upper": 1.491394364351672
      }
    }
  },
  "status": {
    "request_time": "0.579628",
    "response": 200
  }
}</code<br>
              </td>
  		      </tr>
		    </tbody>
		  </table>


<!-- END /api block -->
{% endblock %}
